using System.Data.Entity.ModelConfiguration;
using HBCode.BusinessLogic.Entities;

namespace HBCode.BusinessLogic.Mapping
{
	public class CustomerMap : EntityTypeConfiguration<Customer>
	{
		public CustomerMap()
		{
			// Primary Key
			this.HasKey(t => t.CustomerID);

			// Properties
			this.Property(t => t.CustomerName)
				.HasMaxLength(100);
				
			this.Property(t => t.Email)
				.HasMaxLength(100);
				
			this.Property(t => t.Phone)
				.HasMaxLength(20);
				
			// Table & Column Mappings
			this.ToTable("Customer");
			this.Property(t => t.CustomerID).HasColumnName("CustomerID");
			this.Property(t => t.CustomerName).HasColumnName("CustomerName");
			this.Property(t => t.DOB).HasColumnName("DOB");
			this.Property(t => t.Email).HasColumnName("Email");
			this.Property(t => t.Phone).HasColumnName("Phone");
		}
	}
}

